package com.twu.biblioteca;

public class Book {

    private int id;
    private String name;
    private int noOfCopies;

    public Book(int id, String name, int noOfCopies){
        this.id = id;
        this.name = name;
        this.noOfCopies = noOfCopies;
    }


    public boolean isAvailable(){
        return (noOfCopies > 0);
    }


    public boolean checkOutCopy() {
        if(noOfCopies>0){
            noOfCopies--;
            return true;
        }
        return false;
    }

    public boolean returnCopy() {
        noOfCopies++;
        return true;
    }

    @Override
    public String toString() {
        return id + "\t" + name;
    }
}
